import axios from '@ohos/axios'
const _axios = axios.create({
  baseURL: 'http://127.0.0.1:8080'
})

export const request = (url,method,params,callback) => {
  _axios({
    url,
    method,
    params
  }).then(response => {
    callback(response.data)
  }).catch(error => {
    AlertDialog.show({
      title: '提示',
      message: error.message
    })
  })
}
export const get = (url,params,callback) => {
  request(url, 'get', params, callback)
}
export const post = (url,params,callback) => {
  request(url, 'post', params, callback)
}